package com.uni.controller;

import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.GetMapping;

/**
 * Author:      Unirithe/Mr.Chao
 * CSDN:        https://blog.csdn.net/Unirithe
 * CreatedTime:  2022/2/12 11:13
 **/
@Controller
public class DispatcherController {
    @GetMapping("/about.html")
    public String toAbout(){
        return "about";
    }

    @GetMapping("/admin.html")
    public String toAdmin(){
        return "redirect:/admin/user.html";
    }
    @GetMapping("/admin/user.html")
    public String toAdminUser(ModelMap modelMap){
        modelMap.addAttribute("type", "user");
        return "admin";
    }
    @GetMapping("/admin/role.html")
    public String toAdminRole(){
        return "redirect:/admin/role?pageNow=1";
    }
    @GetMapping("/admin/provider.html")
    public String toAdminProvider(ModelMap modelMap){
        modelMap.addAttribute("type", "provider");
        return "admin";
    }
    @GetMapping("/admin/product.html")
    public String toProduct(ModelMap modelMap){
        modelMap.addAttribute("type", "product");
        return "admin";
    }

    @GetMapping("/admin/roleperm.html")
    public String toRolePerm(ModelMap modelMap){
        modelMap.addAttribute("type", "roleperm");
        return "admin";
    }
    @GetMapping("/admin/perm.html")
    public String toPerm(ModelMap modelMap){
        modelMap.addAttribute("type", "perm");
        return "admin";
    }

}
